clear all;close all;clc;

alfa_m = deg2rad(-180:4:180);
beta_m = deg2rad(-90:4:90);
alfa_f = deg2rad(30);
beta_f = deg2rad(45);
[phi1_f,phi2_f,phi3_f,phi4_f] = fun_prax3(alfa_f,beta_f);
beta_f = exp(-1i*[phi1_f,phi2_f,phi3_f,phi4_f]);

for k =1: length(alfa_m);
    for l = 1:length(beta_m);
        [phi1_m,phi2_m,phi3_m,phi4_m] = fun_prax3(alfa_m(k),beta_m(l));
        y = exp(1i*[phi1_m,phi2_m,phi3_m,phi4_m]);
        F(l,k) = abs(beta_f * y.')^2;
    end;
end;
[alfa_mesh,beta_mesh] = meshgrid(alfa_m,beta_m);
[x,y,z] = sph2cart(beta_mesh,alfa_mesh,F);
figure(1);
surf(alfa_mesh,beta_mesh,F);
figure(2);
surf(x,y,z);




%surf(F);




%result
disp(['phi 1 = ' ,num2str(rad2deg(phi1_f))]);
disp(['phi 2 = ' ,num2str(rad2deg(phi2_f))]);
disp(['phi 3 = ' ,num2str(rad2deg(phi3_f))]);
disp(['phi 4 = ' ,num2str(rad2deg(phi4_f))]);
disp(['beta = ' ,num2str(beta_f)]);